import React, { useState, useEffect } from 'react'
// 所有的 hooks 其实都是函数
// useEffect 其实就是 componentDidMount + componentDidUpdate + componentWillUnmount
function App() {
  const [ count, setCount ] = useState(10)
  const [ proList, setProList ] = useState([])
  useEffect(() => {}) // 内部有就会一直执行
  useEffect(() => {}, []) // 只执行一次
  useEffect(() => {}, [count]) // count的值发生改变才会执行
  useEffect(() => {
    return () => { // componentWillUnmount
    }
  })
  return (
    <div>
      {
        proList && proList.map(item => (
          <div key = { item.proid }>{ item.proname }</div>
        ))
      }
    </div>
  )
}

export default App
